﻿@using GSLMS.WebAPP
@model GSLMS.Entity.TB_LOAN_CONTRACTTMP
@{
    ViewBag.Title = "VConTmpFile";
}
   
   @* <!-- --------------------=== 调用Weboffice初始化方法 ===--------------------- -->
    <script language="javascript" event="NotifyCtrlReady" for="WebOffice1">
    /****************************************************
    *
    *	在装载完Weboffice(执行<object>...</object>)
    *	控件后执行 "WebOffice1_NotifyCtrlReady"方法
    *
    ****************************************************/    	
	    WebOffice1_NotifyCtrlReady();
    </script>

    <script language="javascript" event="NotifyWordEvent(eventname)" for="WebOffice1">
    <!--
        WebOffice1_NotifyWordEvent(eventname)
    //-->
    </script>

    <script language="javascript">
        /****************************************************
        *
        *		控件初始化WebOffice方法
        *
        ****************************************************/
        function WebOffice1_NotifyCtrlReady() {
            document.all.WebOffice1.OptionFlag |= 128;

            var webObj = document.getElementById("WebOffice1");
            webObj.ShowToolBar = false;

            var path = document.getElementById("hfPath").value;
            var filename = document.getElementById("hfFileName").value;
            var documentType = "doc"
            var flag = 0;

            flag = parseInt(document.getElementById("hid_flag").value);
            if (flag >= 100)
                documentType = "xls";


            document.all.WebOffice1.LoadOriginalFile(path + filename, documentType);


        }

        var flag = false;
        function menuOnClick(id) {
            var id = document.getElementById(id);
            var dis = id.style.display;
            if (dis != "none") {
                id.style.display = "none";

            } else {
                id.style.display = "block";
            }
        }
        /****************************************************
        *
        *		接收office事件处理方法
        *
        ****************************************************/
        var vNoCopy = 0;
        var vNoPrint = 0;
        var vNoSave = 0;
        var vClose = 0;
        function no_copy() {
            vNoCopy = 1;
        }
        function yes_copy() {
            vNoCopy = 0;
        }
        function no_print() {
            vNoPrint = 1;
        }
        function yes_print() {
            vNoPrint = 0;
        }
        function no_save() {
            vNoSave = 1;
        }
        function yes_save() {
            vNoSave = 0;
        }
        function EnableClose(flag) {
            vClose = flag;
        }
        function CloseWord() {

            document.all.WebOffice1.CloseDoc(0);
        }

        function WebOffice1_NotifyWordEvent(eventname) {
            if (eventname == "DocumentBeforeSave") {
                if (vNoSave) {
                    document.all.WebOffice1.lContinue = 0;
                    alert("此文档已经禁止保存");
                } else {
                    document.all.WebOffice1.lContinue = 1;
                }
            } else if (eventname == "DocumentBeforePrint") {
                if (vNoPrint) {
                    document.all.WebOffice1.lContinue = 0;
                    alert("此文档已经禁止打印");
                } else {
                    document.all.WebOffice1.lContinue = 1;
                }
            } else if (eventname == "WindowSelectionChange") {
                if (vNoCopy) {
                    document.all.WebOffice1.lContinue = 0;
                    //alert("此文档已经禁止复制");
                } else {
                    document.all.WebOffice1.lContinue = 1;
                }
            } else if (eventname == "DocumentBeforeClose") {
                if (vClose == 0) {
                    document.all.WebOffice1.lContinue = 0;
                } else {
                    //alert("word");
                    document.all.WebOffice1.lContinue = 1;
                }
            }
            //alert(eventname);
        }
        function JustView() {
            vNoCopy = 1;
            vNoPrint = 1;
            vNoSave = 1;
        }
    </script>

    <script type="text/javascript">
        function Save() {
            SaveDoc('293', 'doc', 'set', encodeURI(document.getElementById("<%=hfFileName.ClientID %>").value));
        }
        function openParamDoc() {
            window.open("ParamList.htm", "param", "width=550; height=700,status=no,scrollbars=yes,resizable=yes");
        }
        function openParamDoc1() {
            window.open("ParamApplyList.htm", "param", "width=550; height=700,status=no,scrollbars=yes,resizable=yes");
        }
    </script>*@

<script type="text/javascript">
    /****************************************************
    *
    *		控件初始化WebOffice方法
    *
    ****************************************************/
    function WebOffice1_NotifyCtrlReady() {
        document.all.WebOffice1.OptionFlag |= 128;

        var webObj = document.getElementById("WebOffice1");
        webObj.ShowToolBar = false;


        var path = document.getElementById("SAVEURL").value;
        var documentType = "doc";

        if (path.endwith(".doc"))
            documentType = "doc";

        if (path.endwith(".xls"))
            documentType = "xls";

        document.all.WebOffice1.LoadOriginalFile(path, documentType);

        //setBookMarkValue();
    }

    /****************************************************
    *
    *		接收office事件处理方法
    *
    ****************************************************/
    var vNoCopy = 0;
    var vNoPrint = 0;
    var vNoSave = 0;
    var vClose = 0;
    function no_copy() {
        vNoCopy = 1;
    }
    function yes_copy() {
        vNoCopy = 0;
    }
    function no_print() {
        vNoPrint = 1;
    }
    function yes_print() {
        vNoPrint = 0;
    }
    function no_save() {
        vNoSave = 1;
    }
    function yes_save() {
        vNoSave = 0;
    }
    function EnableClose(flag) {
        vClose = flag;
    }
    function CloseWord() {

        document.all.WebOffice1.CloseDoc(0);
    }

    function NotifyWordEvent(eventname) {

        document.all.WebOffice1.lContinue = 1;

//        if (eventname == "DocumentBeforeSave") {
//            if (vNoSave) {
//                document.all.WebOffice1.lContinue = 0;
//                alert("此文档已经禁止保存");
//            } else {
//                document.all.WebOffice1.lContinue = 1;
//            }
//        } else if (eventname == "DocumentBeforePrint") {
//            if (vNoPrint) {
//                document.all.WebOffice1.lContinue = 0;
//                alert("此文档已经禁止打印");
//            } else {
//                document.all.WebOffice1.lContinue = 1;
//            }
//        } else if (eventname == "WindowSelectionChange") {
//            if (vNoCopy) {
//                document.all.WebOffice1.lContinue = 0;
//                //alert("此文档已经禁止复制");
//            } else {
//                document.all.WebOffice1.lContinue = 1;
//            }
//        } else if (eventname == "DocumentBeforeClose") {
//            if (vClose == 0) {
//                document.all.WebOffice1.lContinue = 0;
//            } else {
//                //alert("word");
//                document.all.WebOffice1.lContinue = 1;
//            }
//        }
        alert(eventname);
    }
    function JustView() {
        vNoCopy = 1;
        vNoPrint = 1;
        vNoSave = 1;
    }

    function setBookMarkValue() {

        document.all.WebOffice1.ProtectDoc(1, 2, "321432");
    }

    
</script>
<div class="pageContent">
   <form method="post" action="Contract/ConTmp/VConTmpFile?OpID=@ViewData["OperateID"]" class="pageForm required-validate"
    onsubmit="return validateCallback(this, dialogAjaxDone);">
    @Html.HiddenFor(model=>model.SAVEURL)
  <div class="pageFormContent" layouth="80">
  
  <p style="width:97%; height:550px;">
    <OBJECT id="WebOffice1" height="520" width="100%" style="LEFT: 0px; TOP: 0px" 
classid="clsid:E77E049B-23FC-4DB8-B756-60529A35FAD5"  codebase="WebOffice.ocx#Version=3,0,0,0">
	<PARAM NAME="_Version" VALUE="65536">
	<PARAM NAME="_ExtentX" VALUE="2646">
	<PARAM NAME="_ExtentY" VALUE="1323">
	<PARAM NAME="_StockProps" VALUE="0"></OBJECT> 

    
  </p>


     </div>
   
    

    </form>

    
</div>
<script type="text/javascript"  language="javascript"  event="NotifyCtrlReady" for="WebOffice1">
    /****************************************************
    *
    *	在装载完Weboffice(执行<object>...</object>)
    *	控件后执行 "WebOffice1_NotifyCtrlReady"方法
    *
    ****************************************************/    	
	    WebOffice1_NotifyCtrlReady();
</script>
@*<script type="text/javascript" language="javascript" event="NotifyWordEvent(eventname)" for="WebOffice1">
  
   <!--
  NotifyWordEvent(eventname);
//-->

</script>
*@